package mr.ali.videoapp.portal.controller;


import com.github.pagehelper.PageInfo;
import mr.ali.videoapp.portal.Exception.R;
import mr.ali.videoapp.portal.model.Collection;
import mr.ali.videoapp.portal.model.CollectionTrailer;
import mr.ali.videoapp.portal.service.ICollectionTrailerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mr-ali
 * @since 2025-06-01
 */
@RestController
@RequestMapping("/portal/collectionTrailer")
public class CollectionTrailerController {

    @Resource
    private ICollectionTrailerService collectionTrailerService;
    /**
     * 首页面的即将上线部分
     */
    @GetMapping("/all")
    public R<PageInfo<CollectionTrailer>> list(Integer pageNum, Integer pageSize , Integer type , Integer order) {
        if (pageNum == null || pageNum == 0) {
            pageNum = 1;
        } else if (pageSize == null || pageNum == 0) {
            pageSize = 6;
        }else if (type == null || type == 0) {
            type = 0;
        }
        PageInfo<CollectionTrailer> videoList = collectionTrailerService.TrailerList(pageNum, pageSize,type,order);
        return R.ok(videoList);
    }
}
